﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using RED_NET_Core.DAL;
using RED_NET_Core.Entity;
using RED_NET_Core.BLL;

namespace RED_NET.ContentPage
{
    public partial class Album : System.Web.UI.Page
    {
        public int toUserId;
        int nowUserId;
        protected void Page_Load(object sender, EventArgs e)
        {
            toUserId = Int32.Parse(Request.Params["VISIT_ID"].ToString());
            Session["VISIT_ID"] = toUserId;//这里是为了给
            if (Session["USER"] == null)//匿名参观，隐掉新建相册功能
                LinkButton1.Visible = false;
            else
            {
                Users user = (Users)Session["USER"];
                nowUserId = user.UserId;
                if (nowUserId != toUserId)//非本人参观，隐掉新建相册功能
                    LinkButton1.Visible = false;
            }
        }

        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/ContentPage/AddAlbum.aspx?VISIT_ID=" + toUserId.ToString());
        }

        protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
        {
            if (e.CommandName.Length > 0 && e.CommandName == "GotoPhotoOfAlbum")
            {
                Response.Redirect("~/ContentPage/Photo.aspx?VISIT_ID=" + toUserId.ToString() + "&Album_ID=" + e.CommandArgument.ToString());
            }
        }
    }
}
